let x = 151555
var mySqrt = function (x) {
    if (x === 0) {
        return 0
    }
    let left = 0
    let right = x + 1
    while (left + 1 < right) {
        let mid = Math.floor((left + right) / 2)
        if (mid * mid < x) {
            left = mid
        } else if (mid * mid > x) {
            right = mid
        } else {
            return mid
        }
    }
    return left

};
console.log(mySqrt(x));
